#!/bin/bash
a=`uname  -a`
 
public_string="Linux"
 
D="Darwin"
C="CentOS"
U="Ubuntu"
 
 
#centos os check
FILE_EXE=/etc/redhat-release
 
if [ -f "$FILE_EXE" ];then
	if [[ `cat /etc/redhat-release` =~ $C ]];then
		echo $C
		sudo yum install -y bison flex
	fi
fi
 
 
if [[ $a =~ $D ]];then
    echo "mac"
elif [[ $a =~ $C ]];then
    echo $C
    sudo yum install -y bison flex
elif [[ $a =~ $U ]];then
    echo $U
    sudo apt-get install -y bison flex
else
    echo $a
fi

cd src/
./configure

sudo mkdir /etc/boa
cd ..
cp boa.conf /etc/boa/boa.conf

cd src/
make

